package com.epoint.springsecuritylearning.rest;

import com.epoint.springsecuritylearning.user.domain.SysUser;
import com.epoint.springsecuritylearning.user.service.UserService;
import com.epoint.springsecuritylearning.util.JwtUtil;
import com.epoint.springsecuritylearning.util.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class LoginRest {

    @Autowired
    @Qualifier("userServiceImpl")
    UserService userService;

    @PostMapping("/login")
    public ResponseResult login(@RequestBody SysUser user){
        return userService.login(user);
    }

    @PostMapping("/user/logout")
    public ResponseResult logout(){
        return userService.logout();
    }


}
